import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 1.创建路由组件
// 2.将路由 与 组件进行映射
// 3.创建router实例

const routes = [
    // 主路由
  {
    path: '/',
    name: 'Main',
    redirect:'/home', // 重定向
    component:()=>import('../views/Main'),
    children:[
      //   // 子路由
      // {path:'home',name:'home',component:()=>import('../views/HomeView')}, // 首页
      // {path:'user',name:'user',component:()=>import('../views/User')},  // 用户管理
      // {path:'mall',name:'mall',component:()=>import('../views/Mall')},  // 商品管理
      // {path:'page1',name:'page1',component:()=>import('../views/PageOne')},  // 页面1
      // {path:'page2',name:'page2',component:()=>import('../views/PageTwo')},  // 页面2
    ]
  },{
    path: '/login',
    name:'login',
    component:()=>import('../views/Login')
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
